1. Field of the Invention
The present invention is directed to a method for testing system components of an object-oriented program wherein arbitrary methods are replaced by stubs and a test frame generator generates stubs that have the same call and return parameters available to them as a function being replaced for simplified testing purposes.
2. Description of the Prior Art
Criteria for the comparison of methods, particularly comparative methods of different presentation possibilities of an object-oriented program are explained in W. Archert, xe2x80x9cObjektorientiert analysierenxe2x80x94Ein xc3x9cbeblick der wichtigsten Methodenxe2x80x9d, Electronik 3/96, pages 80-86. Further, advantages of object-oriented programming are presented, particularly with regard to modularity and portability.
In the development of a software system, it is meaningful to test the individual system components in isolation before the test of the overall system. For example, individual program modules orxe2x80x94given an object-oriented developmentxe2x80x94classes are system components. The problem often arises in the class or module test that a test unit (class or, respectively, module) is highly dependent on other test units. Such dependencies derive, for example, from the mutual employment of functions (or methods, given the employment of classes). The result thereof, however, is that all other test units U that are used by A (directly or indirectly because, for example, U in turn uses other units) must already be present for the test of a test unit A.
Accordingly, an object of the present invention is to simplify and speed up the testing of such test units.
In order to avoid this problem, the present invention produces substitute functions with a dummy functionality for the functions and/or methods from other test units U used by the test unit A. Such substitute functions are also called xe2x80x9cstubsxe2x80x9d. Even when a function/method is already implemented, it can be meaningful for the test of other functions/methods to replace this with a stub.
As a result thereof, the complexity of the test frame can be kept low.
The present invention describes the automatic generation of a minimum set of complete substitute functions (stubs) for employment in the class and/or module test. What is thus meant is that all functions/methods that are declared in the software but whose implementation is either not yet present or, on the other hand, cannot be used for complexity reasons are automatically implemented as substitute functions (stubs). Care is thereby exercised that both the return parameter and the handover parameter of the function/method are generated equivalent to the original function/method for the substitute function. A test frame class is locally instanced in the function/method for the implementation of the substitute function. This test frame class encapsulates an automatic status unit that is defined by the parameters (both return handover parameters) of the function that is replaced by the stub. When farther-reaching logical operations are to be implemented within the stub, this can be manually supplemented.
When the software system begins the test run, a branch is made in the stub according to the preset mode of the test frame class. For example, the mode can be that interactive commands corresponding to a command set of an interpreter integrated in the test frame class are allowed at a command prompt or a command datafile that, for example, generates outputs according to the command of the command datafile is implemented in the substitute function. After the interaction or, respectively, the execution of the command datafile, a branch is made from the substitute function back into the calling module. As soon as it is called, a further substitute function makes the same functionality available with the parameters it has. Thus, specific tests can be implemented for all substitute functions with the one test frame class. The encapsulation of the test frame class as a separate automatic status unit enables the flexible employment in every substitute function. The test frame class instanced for the substitute function is initialized with parameters (both handover and return parameters). Type-specific operations that are interactively called or called from a command datafile can be defined, therefore, in the test frame class.
An advantageous development of the inventive method is sound in the interactive employment of the test frame class. This interaction represents a function scope of an integrated debugger with the command set defined in the test frame class. As in a debugger, commands can be interactively implemented on the parameters visible in the current function.